/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.kamionowski.supreme.services.search;

import org.kamionowski.supreme.persistence.entity.Token;

/**
 *
 * @author soldier
 */
public class QueryToken {
    private final String token;
    private final String expression;
    private final Long count;

    public QueryToken(Token token, String expression){
        this.token = token.getToken();
        this.expression = expression;
        this.count = token.getResultscount();
    }

    public Long getCount() {
        return count;
    }

    public String getExpression() {
        return expression;
    }

    public String getToken() {
        return token;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final QueryToken other = (QueryToken) obj;
        if ((this.token == null) ? (other.token != null) : !this.token.equals(other.token)) {
            return false;
        }
        if ((this.expression == null) ? (other.expression != null) : !this.expression.equals(other.expression)) {
            return false;
        }
        if (this.count != other.count && (this.count == null || !this.count.equals(other.count))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 61 * hash + (this.token != null ? this.token.hashCode() : 0);
        hash = 61 * hash + (this.expression != null ? this.expression.hashCode() : 0);
        hash = 61 * hash + (this.count != null ? this.count.hashCode() : 0);
        return hash;
    }

}
